<?php

$this->registerCssFile('https://cdn.bootcdn.net/ajax/libs/jquery-jsonview/1.2.3/jquery.jsonview.min.css');
$this->registerJsFile("https://cdn.bootcdn.net/ajax/libs/jquery-jsonview/1.2.3/jquery.jsonview.min.js", ["depends" => [\yii\web\JqueryAsset::className()]]);
?>
    <div class="wrapper wrapper-content ibox-content">
        <form class="form-horizontal m-t" id="signupForm">
            <div class="form-group">
                <label class="col-sm-2 control-label">请求地址：</label>
                <div class="form-control-static">
                    <?= $operLog->oper_url; ?>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">登录信息：</label>
                <div class="form-control-static">
                    <?= $roleNameStr . ' / ' . $admin . ' / ' . $operLog->oper_ip ?>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">请求方式：</label>
                <div class="form-control-static">
                    <?= $operLog->request_method; ?>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">User Agent：</label>
                <div class="form-control-static" style="width: 83%;    float: right;">
                    <?= $operLog->oper_agent; ?>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请求参数：</label>
                <div class="form-control-static">
                    <pre id="operParam"></pre>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">返回参数：</label>
                <div class="form-control-static">
                    <pre id="jsonResult"></pre>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">状态：</label>
                <div class="form-control-static">
                <span class="<?= $operLog->status == 1 ? 'label label-primary' : 'label label-danger' ?>">
                      <?= $operLog->status == 1 ? '正常' : '异常' ?>
                </span>
                </div>
            </div>
            <div class="form-group" style="display:<?= $operLog->status == 0 ? 'none' : 'block' ?>">
                <label class="col-sm-2 control-label">异常信息：</label>
                <div class="form-control-static">
                    <?= $operLog->error_msg ?>
                </div>
            </div>
        </form>
    </div>
    <script>
        <?php $this->beginBlock('js_end')?>
        $(function () {
            var operParam = <?=$operLog->oper_param ? $operLog->oper_param : '{}';?>;
            operParam = JSON.stringify(operParam);
            if ($.common.isNotEmpty(operParam) && operParam.length < 2000) {
                $("#operParam").JSONView(operParam);
            } else {
                $("#operParam").JSONView(operParam);
            }
            var jsonResult = <?=$operLog->json_result ? $operLog->json_result : '{}';?>;
            jsonResult = JSON.stringify(jsonResult);
            if ($.common.isNotEmpty(jsonResult) && jsonResult.length < 2000) {
                $("#jsonResult").JSONView(jsonResult);
            } else {
                $("#jsonResult").JSONView(jsonResult);
            }
        });
        <?php $this->endBlock()?>
    </script>
<?php $this->registerJs($this->blocks['js_end'], \yii\web\View::POS_END); ?>